home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / V15N04.ZIP / WARPCA.ZIP / WCABSRC.ZIP / FILEASOC.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-18  |  1.4 KB  |  44 lines

  1. // FILEASOC.H -- Class for to manage file types and associations
  2. #if !defined(_FILEASOC_H)
  3. #define _FILEASOC_H
  4.  
  5. class FILEASSOCIATION
  6. {
  7. public:
  8.     char szExt[4];
  9.     char szDesc[128];
  10.     char szEXEPathName[256];
  11.     int iImage;   // Image used to represent this file type in listbox.
  12.  
  13.     // Constructor
  14.     FILEASSOCIATION(LPSTR lpszMyFileExt = NULL, LPSTR lpszMyDesc = NULL, LPSTR lpszMyEXEPath = NULL, int nMyImage = ID_DOCUMENT);
  15.  
  16.     // Copy constructor
  17.     FILEASSOCIATION::FILEASSOCIATION(const FILEASSOCIATION& OldAssoc);
  18.  
  19.     BOOL SaveToProfileFile(HWND hwnd, LPSTR lpszPRFFilename, LPSTR lpszSection, int nIndex);
  20.  
  21.     BOOL LoadFromProfileFile(HWND hwnd, LPSTR lpszPRFFilename, LPSTR lpszSection, int nIndex);
  22.  
  23.     const FILEASSOCIATION operator=(const FILEASSOCIATION& OldAssoc)
  24.     {
  25.         strcpy(szExt, OldAssoc.szExt);
  26.         strcpy(szDesc, OldAssoc.szDesc);
  27.         strcpy(szEXEPathName, OldAssoc.szEXEPathName);
  28.         iImage = OldAssoc.iImage;
  29.  
  30.         return *this;
  31.     }
  32.  
  33.     int operator<(const FILEASSOCIATION& CompareItem) { int rc = strcmpi(szExt, CompareItem.szExt);
  34.                                                                  if(rc < 0) return TRUE; else return FALSE; }
  35.  
  36.     int operator==(const FILEASSOCIATION& CompareItem) { if(strcmpi(szExt, CompareItem.szExt) == 0)
  37.                                                                   return TRUE; else return FALSE; }
  38. };
  39.  
  40. // Search function for use with TISArrayAsVector::FirstThat(), TISArrayAsVector::LastThat().
  41. int FindFileAssociation(const FILEASSOCIATION& ThisRec, void *pMatchExt);
  42.  
  43. #endif
  44.